/*

Summary:
ComboBox class.

Remark:
WARNING, not all method is been tested well.

Version:
0.1.1

LastUpdaedDate:
2012-09-21

CreatedDate:
2012-09-06

*/


#pragma once

#include "ControlWindow.h"
#include "..\..\Enum.h"



namespace Zaf {
namespace Mwl {
namespace __Internal {
	class WndProcPicker;
}


ZafEnum(DropDownStyle, DWORD) {

	Simple,
	DropDown,
	DropDownList,
};


class ComboBox : public ControlWindow {

public:
	ComboBox();
	explicit ComboBox(WORD id);
	virtual ~ComboBox();

	DropDownStyle GetDropDownStyle() const;
	void SetDropDownStyle(DropDownStyle value);

	bool IsAutoSort() const;
	void IsAutoSort(bool value);

	bool IsLowercase() const;
	void IsLowercase(bool value);

	bool IsUppercase() const;
	void IsUppercase(bool value);

	bool IsAutoHorizontalScroll() const;
	void IsAutoHorizontalScroll(bool value);

	bool AlwaysShowScrollbar() const;
	void AlwaysShowScrollbar(bool value);

	unsigned int GetTextLimit() const;
	void SetTextLimit(unsigned int value);

	int AddString(const wchar_t* value);
	int AddString(const std::wstring& value) { return AddString(value.c_str()); }

	int InsertString(const wchar_t* value, int pos);
	int InsertString(const std::wstring& value, int pos) { return InsertString(value.c_str(), pos); }

	int DeleteString(int index);

	int FindString(const wchar_t* value, int pos = -1) const;
	int FindString(const std::wstring& value, int pos = -1) const { return FindString(value.c_str(), pos); }

	int FindStringExactly(const wchar_t* value, int pos = -1) const;
	int FindStringExactly(const std::wstring& value, int pos = -1) const { return FindStringExactly(value.c_str(), pos); }

	int GetCount() const;

	int GetSelectedIndex() const;
	int SetSelectedIndex(int value);

	void Clear();

	bool IsDropDownVisible() const;
	void IsDropDownVisible(bool value);

protected:
	LRESULT DefWndProc(const WndMsg&);

private:
	void CommonContructor();
	HWND CreateConcreteWindow();

	void OnCreated(CreatedEventArgs& arg);

	static const wchar_t* const ClassName;
	static __Internal::WndProcPicker ComboBoxWndProc;

	unsigned int m_textLimit;
};



}
}